package edu.sctu.zcy.month201506.day20150614.iotest;

import java.io.*;

/**
 * Created by user24 on 2015/6/14.
 */
public class ProgramEntry {

    private static final String FILE_PATH = "D://ZCY1";
    private static final String CREATE_NEW_FILE_ONE = "//zcy1.txt";
    private static final String CREATE_NEW_FILE_TWO = "//zcy2.txt";

    public static void main(String[] args) {

        try {
            new ProgramEntry().creat();
        } catch (IOException e) {
            e.printStackTrace();
        }


    }

    public void creat()  throws IOException{

        BufferedReadDemo bufferedReadDemo = new BufferedReadDemo();
        File file = new File(FILE_PATH);
        bufferedReadDemo.creatFile(file);

        File file1 = bufferedReadDemo.creatNewFile(FILE_PATH, CREATE_NEW_FILE_ONE);

        File file2 = bufferedReadDemo.creatNewFile(FILE_PATH, CREATE_NEW_FILE_TWO);

        FileReader fileReader = new FileReader(file1);
        BufferedReader bufferedReader = new BufferedReader(fileReader);

        FileWriter fileWriter = new FileWriter(file2);
        BufferedWriter bufferedWriter = new BufferedWriter(fileWriter);

        while (bufferedReader.ready()){

            String instr = bufferedReader.readLine();
            System.out.println("行的内容："+instr);

            bufferedWriter.write(instr);
            bufferedWriter.newLine();
        }

        bufferedWriter.close();
        bufferedReader.close();

        System.out.println("成功创建zcy2.txt");

    }

}
